//
// Created by Administrator on 2020/10/22.
//

#include "rfNngDef.h"
#include "rfNngImpl.h"

typedef struct {
    // Common attributes
    char*            devname;
    rf_info_t info;
    uint32_t         nof_channels;

    // RF State
    uint32_t srate; // radio rate configured by upper layers
    uint32_t base_srate;
    uint32_t decim_factor; // decimation factor between base_srate used on transport on radio's rate
    double   rx_gain;
    uint32_t tx_freq_mhz[O5G_RF_CHANNEL_NUM_MAX];
    uint32_t rx_freq_mhz[O5G_RF_CHANNEL_NUM_MAX];
    int8_t   tx_off;
    char     id[RF_PARAM_LEN];

    // Server
    void*       context;
    rf_nng_tx_t transmitter[O5G_RF_CHANNEL_NUM_MAX];
    rf_nng_rx_t receiver[O5G_RF_CHANNEL_NUM_MAX];

    // Various sample buffers
    cfloat_t* buffer_decimation[O5G_RF_CHANNEL_NUM_MAX];
    cfloat_t* buffer_tx;

    // Rx timestamp
    uint64_t next_rx_ts;

    pthread_mutex_t tx_config_mutex;
    pthread_mutex_t rx_config_mutex;
    pthread_mutex_t decim_mutex;
} rf_nng_handler_t;

int rf_nng_open(char* args, void** handler)
{

}

int rf_nng_open_multi(char* args, void** handler, uint32_t nof_channels)
{

}

const char* rf_nng_devname(void* h)
{

}

int rf_nng_close(void* h)
{

};

int rf_nng_start_rx_stream(void* h, int8_t now)
{

}

int rf_nng_start_rx_stream_nsamples(void* h, uint32_t nsamples)
{

}

int rf_nng_stop_rx_stream(void* h)
{

}

void rf_nng_flush_buffer(void* h)
{

}

int8_t rf_nng_has_rssi(void* h)
{

}

float rf_nng_get_rssi(void* h)
{

}

double rf_nng_set_rx_srate(void* h, double freq)
{

};

double rf_nng_set_rx_gain(void* h, double gain)
{

}

double rf_nng_get_rx_gain(void* h)
{

};

double rf_nng_get_tx_gain(void* h)
{

}

rf_info_t* rf_nng_get_info(void* h)
{

}

void rf_nng_suppress_stdout(void* h)
{

}

void rf_nng_register_error_handler(void* h, rf_error_handler_t error_handler, void* arg)
{

}

double rf_nng_set_rx_freq(void* h, uint32_t ch, double freq)
{

}

int
rf_nng_recv_with_time(void* h, void* data, uint32_t nsamples, int8_t blocking, time_t* secs, double* frac_secs)
{

}

int
rf_nng_recv_with_time_multi(void* h, void** data, uint32_t nsamples, int8_t blocking, time_t* secs, double* frac_secs)
{

}

double rf_nng_set_tx_srate(void* h, double freq)
{

}

double rf_nng_set_tx_gain(void* h, double gain)
{

}

double rf_nng_set_tx_freq(void* h, uint32_t ch, double freq)
{

}

void rf_nng_get_time(void* h, time_t* secs, double* frac_secs)
{

}

int rf_nng_send_timed(void*  h,
    void*  data,
    int    nsamples,
    time_t secs,
    double frac_secs,
    int8_t   has_time_spec,
    int8_t   blocking,
    int8_t   is_start_of_burst,
    int8_t   is_end_of_burst)
{

}

int rf_nng_send_timed_multi(void*  h,
    void*  data[4],
    int    nsamples,
    time_t secs,
    double frac_secs,
    int8_t   has_time_spec,
    int8_t   blocking,
    int8_t   is_start_of_burst,
    int8_t   is_end_of_burst)
{

}
